function register() {
    var inputEmail = $("#inputEmail").val();
    var code = $("#code").val();
    var inputPassword = $("#inputPassword").val();
    var twoPassword = $("#twoPassword").val();
    layui.use('layer', function() {
        var layer = layui.layer
        if (inputEmail !== "" && code !== "" && inputPassword!=="" && twoPassword !== ""&& inputPassword === twoPassword) {
            $.post("/register", {"email": inputEmail, "pwd": inputPassword, "code": code}, function (data) {
                if (data.code === 200) {
                    window.location.href = "index.html"
                }
                layer.msg(data.msg)
            }, "json")
        } else {
            layer.msg("两次密码不一致")
        }
    })
}
function getCode() {
    var inputEmail = $("#inputEmail").val();
    layui.use('layer', function() {
        let layer = layui.layer
        if (inputEmail===""){
            layer.msg("请输入邮箱")
        }else {
            $.post("/code", {"email": inputEmail}, function (data) {
                layer.msg(data.msg)
            }, "json")
        }
    })
}